package groupby.util;

import java.util.List;

public class Pages {

	private int pageSize;
	private int totalPage;
	private int rowCount;
	private int currentPage=1;
	private int prePage;
	private int nextPage;
	
	private boolean hasNextPage;
	private boolean hasPrePage;


	public Pages() {
		this.pageSize = 10;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int rowCount) {
		if (rowCount % pageSize > 0) {
			totalPage = rowCount / pageSize + 1;
		} else {
			totalPage = rowCount / pageSize;
		}
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
    public void setPreNextPage()
    {
    	nextPage = currentPage + 1; 

		if (nextPage >= totalPage) { 
		  nextPage = totalPage; 
		  hasNextPage=false;
		} else
		{
			hasNextPage=true;
		}

		prePage = currentPage - 1; 

		if (prePage <= 1) { 
			prePage = 1; 
			hasPrePage=false;
		} else
		{
			hasPrePage=true;
		}
    }
	public int getPrePage() {
		return prePage;
	}

	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}

	public int getNextPage() {
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	public boolean isHasNextPage() {
		return hasNextPage;
	}

	public void setHasNextPage(boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}

	public boolean isHasPrePage() {
		return hasPrePage;
	}

	public void setHasPrePage(boolean hasPrePage) {
		this.hasPrePage = hasPrePage;
	}


}
